#include <bits/stdc++.h>
// 2025/03/04
// tag: 
// Author: Forever
using namespace std;

using int64 = int64_t;
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t, x, y;
    cin >> t;
    while (t--){
        cin >> x >> y;
        if (x == y || y > x + 1)
            cout << "No" << endl;
        else if ((x - y + 1) % 9 == 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}